package tokens;

import java.util.ListIterator;
import java.util.Queue;
import java.util.Stack;
import nodes.AbstractNode;
import nodes.VariableNode;

/**
 * A variable token
 * 
 * @author Charlie Hatcher
 * @author Roman
 */
public class VariableToken extends AbstractToken {
	private static final String VARIABLE_REGEX = ":[a-zA-Z][\\w]*";

	@Override
	public boolean matchToken(String str, ListIterator<String> it) {
		return (str.matches(VARIABLE_REGEX));
	}

	@Override
	public String toString() {
		return syntaxBundle.getString("variable_label");
	}

	@Override
	public void handleParser(String str, ListIterator<String> it,
			Stack<AbstractBinaryToken> opStack,
			Queue<AbstractNode> outPutQueue, Queue<AbstractNode> queue)
			throws Exception {
		outPutQueue.add(new VariableNode(str, myModel));

	}
}
